package com.withyou.euraka.provide.web;

import java.util.concurrent.ExecutionException;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.withyou.euraka.provide.api.common.ResultVo;
import com.withyou.euraka.provide.domain.Order;
import com.withyou.euraka.provide.service.OrderService;

@RestController
@RequestMapping("/order")
public class OrderController {

	@Autowired
	private OrderService orderService;
	
	@ApiOperation(value="下单")
	@ApiResponses({
		@ApiResponse(code=500,message="服务异常")
	})
	@PostMapping("/{id}")
	public ResultVo<Boolean> order(@PathVariable String id, Order order) throws InterruptedException, ExecutionException{
		return orderService.createOrder(order);
	}
}
